# Contributor: Jake Buchholz Göktürk <tomalok@gmail.com>
# Maintainer: Jake Buchholz Göktürk <tomalok@gmail.com>
pkgname=cachefilesd-inotify
pkgver=0.11.0
pkgrel=2
pkgdesc="Userspace daemon acting as a backend for FS-Cache (uses INOTIFY instead of DNOTIFY)"
url="https://gitlab.com/tomalok/cachefilesd-inotify"
arch="all"
license="GPL-2.0-or-later"
depends="attr"
makedepends="rpm file"
provides="cachefilesd=$pkgver-r$pkgrel"
replaces="cachefilesd"
options="!check"
subpackages="$pkgname-doc $pkgname-openrc"
source="https://gitlab.com/tomalok/cachefilesd-inotify/-/archive/$pkgver/$pkgname-$pkgver.tar.bz2
	cachefilesd.initd
	musl-stat64.patch
"

build() {
	sed -i "s#/sbin/#/usr/bin/#g" cachefilesd.c
	sed -i "s#/sbin/#/usr/bin/#g" cachefilesd.service
	sed -i "s/^secctx/#secctx/g" cachefilesd.conf
	make CFLAGS="$CFLAGS"
}

package() {
	make DESTDIR="$pkgdir" SBINDIR=/usr/bin install
	mkdir -p "$pkgdir"/var/cache/fscache
	install -D -m 755 "$srcdir/cachefilesd.initd" "$pkgdir/etc/init.d/cachefilesd"
}

sha512sums="
f283d0d2357da648515225a5162b53a4603fc466d291a68c4833a39ce1aed2784f9734a23ebcb47d1efbea0d3659733f9c1d8a0137e6e98281e6f4085328d049  cachefilesd-inotify-0.11.0.tar.bz2
854b66470ace24caf24e979de3c1c12a426972bc745823b3a0f47ac80811ac5da4fa6a249e65386acdec2e7561178bb1d2c4b301a2178458f10496bb8eac5b2f  cachefilesd.initd
e4611595320bb4d6168d2b5a5b3d711251041c25cf8d6e1a4e58122a732ee971fe34d5968dedaa36f6d1e1951af218c931b133da5d208eef0e325334bd63e627  musl-stat64.patch
"
